package com.sl.biz.modular.office.dao.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sl.biz.modular.office.dao.domain.entity.OfficeRecordDO;
import com.sl.biz.modular.office.dao.mapper.OfficeRecordMapper;
import com.sl.biz.modular.office.dao.service.OfficeRecordDaoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class OfficeRecordDaoServiceImpl extends ServiceImpl<OfficeRecordMapper, OfficeRecordDO> implements OfficeRecordDaoService {
    @Override
    public List<OfficeRecordDO> list(OfficeRecordDO jobConfigDO) {

        LambdaQueryWrapper<OfficeRecordDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(StrUtil.isNotBlank(jobConfigDO.getGroupId()), OfficeRecordDO::getGroupId, jobConfigDO.getGroupId());
        lambdaQueryWrapper.eq(StrUtil.isNotBlank(jobConfigDO.getProductId()), OfficeRecordDO::getProductId, jobConfigDO.getProductId());
        lambdaQueryWrapper.eq(StrUtil.isNotBlank(jobConfigDO.getTypeCode()), OfficeRecordDO::getTypeCode, jobConfigDO.getTypeCode());

        return super.list(lambdaQueryWrapper);
    }
}
